package com.duoduo.http;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

public class HttpUtil {

	public HttpUtil() {
	}

	public static InputStream getInputStream(String url_path)
			throws IOException {
		InputStream inputStream = null;
		try {
			URL url = new URL(url_path);
			HttpURLConnection httpConn = (HttpURLConnection) url
					.openConnection();
			httpConn.setConnectTimeout(8000);
			httpConn.setRequestMethod("GET");
			int responseCode = httpConn.getResponseCode();
			if (responseCode == 200) {
				inputStream = httpConn.getInputStream();
			}
		} catch (MalformedURLException e) {
			e.printStackTrace();
		}
		return inputStream;

	}
}
